package chunithmlauncher.view;

import de.felixroske.jfxsupport.SplashScreen;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;


import java.io.IOException;
import java.io.InputStream;

public class LoadingView extends SplashScreen {

    public ImageView getLogo() throws IOException {
            InputStream stream = getClass().getResourceAsStream("/images/logo.png");;
            Image image = new Image(stream);
            ImageView imageView = new ImageView();
            //将图像设置为图像视图
            imageView.setImage(image);
            imageView.setX(10);
            imageView.setY(10);
            imageView.setFitWidth(575);
            imageView.setPreserveRatio(true);
            return imageView;
    }

    @Override
    public String getImagePath() {
        return "/images/logo.png";
    }

    @Override
    public Parent getParent() {

        ImageView imageView = new ImageView();
        //将图像设置为图像视图
        try {
            imageView = getLogo();
        } catch (IOException e) {
            e.printStackTrace();
        }
        Group gp = new Group(imageView);
        return gp;
    }
}